package org.vectrics.recruiter.struts.tag;

import org.vectrics.common.view.FieldTable;
import org.vectrics.company.CompanyPerson;
import org.vectrics.provider.CoreServiceLocator;
import org.vectrics.struts.VectricsTagSupport;

/**
 * @author mmoore
 */
public class CompanyPersonViewTag extends VectricsTagSupport {
	public static final long serialVersionUID = 190325235635234L;

	private String companyPersonId = null;
	
	/*
	 * @see org.vectrics.struts.VectricsTagSupport#makeStartTag()
	 */
	public String makeStartTag() {
        FieldTable table = new FieldTable();
        table.setCellPadding(2);
        table.setWidth(500);
        table.setValueCellWidth("350");
        
		log.info("CompanyPersonID=" + this.companyPersonId);
		CompanyPerson companyPerson = CoreServiceLocator.getCompanyService().findCompanyPerson(
		        new Long(this.getCompanyPersonId())); 
        table.showField("Company", companyPerson.getCompany().getName());
        table.showField("Person", companyPerson.getPerson().getName());
        table.showField("Title", companyPerson.getTitle());
        return(table.toString());
	}

	/**
	 * @return Returns the companyPersonId.
	 */
	public String getCompanyPersonId() {
		return companyPersonId;
	}
	/**
	 * @param companyPersonId The companyPersonId to set.
	 */
	public void setCompanyPersonId(String companyPersonId) {
		this.companyPersonId = companyPersonId;
	}
}
